<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="css/style.css">
        <script>
            /*function makeitso() {
                servidor.open("GET","dados.php?q="+str,true);
                servidor.onreadystatechange= processaResposta;
                servidor.send();
            }*/
            function showHint()
            {
                
                //makeitso();
                var xmlhttp;
                document.getElementById("txtHint").innerHTML="";
           
                if (window.XMLHttpRequest)
                {// code for IE7+, Firefox, Chrome, Opera, Safari
                    xmlhttp=new XMLHttpRequest();
                }
                else
                {// code for IE6, IE5
                    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.onreadystatechange=function()
                {
                    if (xmlhttp.readyState==4 && xmlhttp.status==200)
                    {
                        
                        var onclick="";
                        document.getElementById("txtHint").innerHTML = "";
                        //alert(xmlhttp.responseText);
                        classes = eval("("+xmlhttp.responseText+")");
                        alert(classes);
                        for (tripulante in classes) {
                            //onclick="onclick="+"form('"+usr[tripulante].nome+"','"+usr[tripulante].email+"','"+usr[tripulante].logname+"','"+usr[tripulante].senha+"','"+usr[tripulante].cpf+"','"+usr[tripulante].nascimento+"','"+usr[tripulante].sexo+"','"+usr[tripulante].estadoCivil+"');";
                            //document.getElementById("txtHint").innerHTML +='<table border="1" height= "75px" width= "600px"><tr><td>Nome</td></tr> <tr><td><a  '+onclick+'> '+usr[tripulante].nome+" </a></td></tr>";
                            document.getElementById("txtHint").innerHTML +=classes[tripulante].toString();
                        }
                        //alert(onclick);
                    }
                }
                xmlhttp.open("GET","testedasclasses.php?acao=lista",true);
                xmlhttp.send();
            }
            function form(nome,email,logname,senha,cpf,nascimento,sexo,civil)
            {
                var xmlhttp;
                if (window.XMLHttpRequest)
                {// code for IE7+, Firefox, Chrome, Opera, Safari
                    xmlhttp=new XMLHttpRequest();
                }
                else
                {// code for IE6, IE5
                    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.onreadystatechange=function()
                {
                    if (xmlhttp.readyState==4 && xmlhttp.status==200)
                    {
                        document.getElementById("form").innerHTML=xmlhttp.responseText;
                    }
                }
                xmlhttp.open("GET","form.php?nome="+nome+"&email="+email+"&logname="+logname
                    +"&senha="+senha+"&cpf="+cpf+"&nascimento="+nascimento+"&sexo="+sexo+"&civil="+civil,true);
                xmlhttp.send();
            }
        </script>
    </head>
    <body>
        <h3>Lista de Pessoas Cadastradas:</h3>
        
            <button id="classes" onclick="showHint()">
                Lista de Classes
            </button>
       


        <p id="txtHint"></p>


        <p id="form"></p>


    </body>
</html>